package com.komorebi.friends.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.komorebi.friends.common.ErrorCode;
import com.komorebi.friends.exception.ThrowUtils;
import com.komorebi.friends.model.entity.Tag;
import com.komorebi.friends.service.TagService;
import com.komorebi.friends.mapper.TagMapper;
import org.springframework.stereotype.Service;

/**
* @author LX-MF
* @description 针对表【tag(标签表)】的数据库操作Service实现
* @createDate 2024-09-21 15:19:21
*/
@Service
public class TagServiceImpl extends ServiceImpl<TagMapper, Tag>
    implements TagService{


    @Override
    public Long getTagIdByName(String name) {
        Tag tag = query().eq("tagName", name).one();
        ThrowUtils.throwIf(tag == null, ErrorCode.PARAMS_ERROR, "标签不存在");
        return tag.getId();
    }
}




